package com.wenguo.common.util;

import java.util.Properties;

import org.apache.log4j.Logger;

import com.wenguo.Constants;

public final class ConfigLoader {
	
	private final static Logger logger = Logger.getLogger(ConfigLoader.class);

	private static ConfigLoader configLoader;
	private PropertiesUtil propUtil;
	private Properties jdbcProp;
	private Properties sqlProp;

	private ConfigLoader() {
		if (null == propUtil) {
			propUtil = PropertiesUtil.getInstance();
		}
	}

	public static ConfigLoader getInstance() {
		if (configLoader == null) {
			configLoader = new ConfigLoader();
		}
		return configLoader;
	}

	public void load() {
		logger.info("<LOAD>"+ Constants.conf.CONF_PATH +"</LOAD>");
		jdbcProp = propUtil.loadProperties(Constants.conf.CONF_PATH);
		logger.info("<LOAD>"+ Constants.conf.SQL_PATH +"</LOAD>");
		sqlProp = propUtil.loadProperties(Constants.conf.SQL_PATH);
	}

	public Properties getJdbcProp() {
		return jdbcProp;
	}

	public Properties getSqlProp() {
		return sqlProp;
	}
	
	
}
